<template>
    <div>
        <detail-banner :swiper="swiper" :sightName = "sightName"></detail-banner>
        <detail-header></detail-header>
        <div class="content">
          <detail-list :list = "list"></detail-list>
        </div>
    </div>
</template>

<script>
import DetailBanner from './components/Banner'
import DetailHeader from './components/Header'
import DetailList from './components/List'
import axios from 'axios'
export default {
  name: 'Detail',
  data () {
    return {
      swiper: [],
      list: [],
      sightName: ''
    }
  },
  components: {
    DetailBanner,
    DetailHeader,
    DetailList
  },
  methods: {
    getInfo () {
      axios.get('api/detail.json', {
        params: {
          id: this.$route.params.id
        }
      })
        .then(this.getDataSucc)
    },
    getDataSucc (res) {
      res = res.data
      console.log(res)
      if (res.ret && res.data) {
        const data = res.data
        this.list = data.categoryList
        this.swiper = data.gallaryImgs
        this.sightName = data.sightName
        console.log(this.sightName)
      }
    }
  },
  mounted () {
    this.getInfo()
  }
}
</script>

<style lang="stylus" scoped>
  .content
    height: 50rem
</style>
